<?php if (@count($list['list'])==0) exit;?>
<ul>
<?php foreach ($list['list'] as $v):?>
<?php $item_i++; echo '<li onclick="$(\'filter\').value=\''. $v['name'] .'\';$(\'asform\').submit()" title="'. $v['name'] .'">'. utf8_substr($v['name'], 0, 21) .'</li>'?>

<?php endforeach;?>
<?php if (count($list['list']) >= 100) echo '<li style="text-align:center"><span class="informal"><a href="/itemlist?filter='. urlencode($search) .'">更多结果</a> &raquo;</span></li>'?>
</ul>

<?php
function utf8_substr($str,$start) {
    preg_match_all("/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/", $str, $ar);
    if(func_num_args() >= 3) {
       $end = func_get_arg(2);
       return join("",array_slice($ar[0],$start,$end));
    } else {
       return join("",array_slice($ar[0],$start));
    }
}
?>
